<!--
 * @Descripttion:
 * @version:
 * @Author: zhuzm@linkstec.com
 * @Date: 2023-01-09 15:01:06
 * @LastEditors: sueRimn
 * @LastEditTime: 2023-04-07 14:33:34
-->
<template>
  <div class="search-list-individuate">
    <div class="list-item" v-for="(item, index) in dataFilter" :key="index" @click="goDetail(item)">
      <h2 class="name" v-html="item.title_v"></h2>
      <div class="code" v-html="`(${item.stockCode})`"></div>
    </div>
  </div>
</template>
<script>
import { verifyRoles } from '@/utils/verify';
export default {
  props: {
    data: {
      type: Array,
      default: () => {
        return [];
      }
    },
    max: {
      type: Number,
      default: Infinity
    }
  },
  computed: {
    dataFilter () {
      if (this.max === Infinity) return this.data;
      return this.data.slice(0, this.max);
    }
  },
  methods: {
    // 研报词条跳转
    goDetail (item) {
      const judge = verifyRoles('GTJA', 0);
      if (!judge) {
        return;
      }
      const id = item.id || item.reportId;
      if (item.reportType == 'xst') {
        window.location.href = process.env.VUE_APP_SERVICE_CP_NEWPREPORTDETAILS + '\\' + id;
      } else {
        window.location.href = process.env.VUE_APP_SERVICE_CP_PREPORTDETAILS + '\\' + id;
      }
    }
  }
};
</script>
<style lang="scss" scoped>
@import './common.scss';
.search-list-individuate{
  .list-item{
    margin-bottom: 11px;
    display: flex;
    cu
    .code{
      font-size: 14px;
      color: #818181;
      margin-left: 8px;
    }
  }
}
</style>
